<?php
namespace Admin\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
        $user = session('user_auth');
        //p($user);
        //$category = $this->category();
        $model = M('Category');
        $category = $model->select();
        $newcategory = array();
        foreach ($category as $key => $v) {
            $newcategory[$key]['url'] = U("Article/index",array('category'=>$v['id']));
            $newcategory[$key]['id'] = $v['id'];
            $newcategory[$key]['pid'] = $v['pid'];
            $newcategory[$key]['name'] = $v['name'];
            $newcategory[$key]['ename'] = $v['ename'];
        }
        //p($newcategory);
        $this->assign('category',$newcategory);
        $this->display();
    }
    protected function category(){
        

        return $category;
    }
    
}